package com.qfmy.model.enums;

/**
 * @author 清风明月
 * @Package com.qfmy.model.enums
 * @date 2025/11//11
 * @description 小说的状态
 */
public enum NovelStatus implements BaseEnum{

    LIVE(0, "连载"),
    FINISH(1, "完结"),
    BREAK(2, "断更");

    /**
     * 枚举值
     */
    private Integer code;

    /**
     * 枚举描述
     */
    private String name;

    NovelStatus(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 获取枚举值
     * @return
     */
    @Override
    public Integer getCode() {
        return this.code;
    }

    /**
     * 获取枚举描述
     * @return
     */
    @Override
    public String getName() {
        return this.name;
    }

    /**
     * 根据code值获取name
     */
    public static String getNameByCode(Integer code) {
        for (NovelStatus value : values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

}
